/**
 * @see 封装Ztree，简单化操作,设置全局参数
 * @since 2016年1月21日
 * @category js
 * @author 杨阳
 */

(function($) {
	$tree = function(treeID, options){
		var settings = {
			view:{
				showTitle:true,
				showLine:false,
				showIcon:false
			},
			async:{
				enable: true,
				url:"",
				type:"post",
				autoParam:["id", "name=n", "level=lv"],
				otherParam:{"otherParam":"zTreeAsyncTest"}
			}
		};
		
		var opts = $.extend({}, settings, options);
		$.fn.zTree.init($("#"+treeID), setting);
		
	};
})(jQuery);


/**
 * 获得tree的对象
 */
function getTreeObject(treeID){
	
	var treeObj = $.fn.zTree.getZTreeObj(treeID);
	
	return treeObj;
	
}

/**
 * 获取 zTree 当前被选中的节点数据集合
 */
function getSelectedTreeNodes(treeID){
	
	var treeObj = $.fn.zTree.getZTreeObj(treeID);
	var nodes = treeObj.getSelectedNodes();
	
	return nodes;
}